var promoPaikeOSArr = new Array();
var promoPaikeOSIDArr = new Array();
var promoPaikeNameArr = new Array();
var promoPaikeIDArr = new Array();
var promoPaikeOSOrderArr = new Array();
var promoPaikeNameOrderArr = new Array();
var promoPaikeOSSel;
var promoPaikeNameSel;
var promoPaikeTypeSel;
var promoPaikePeroidSel;

var phoneTypes = new Array();
var phoneTypesWPid  = new Array();
var osTypes = new Array();
var promoPaikeDates = new Array();
var promoPaikeData = new Array();


function loadPromoPaikeList(data) {
	promoPaikeOSArr = new Array();
	promoPaikeOSIDArr = new Array();
	promoPaikeNameArr = new Array();
	promoPaikeIDArr = new Array();
	promoPaikeOSOrderArr = new Array();
	promoPaikeNameOrderArr = new Array();
	promoPaikeOSSel = document.getElementById("PromoPaikeOS");
	promoPaikeNameSel  = document.getElementById("PromoPaikeFactory");
	promoPaikeTypeSel  = document.getElementById("PromoPaikeType");
	promoPaikeOSSel.options.length = 0;
	promoPaikeNameSel.options.length = 0;
	promoPaikeOSSel.options.add(new  Option("全部", ""));
	promoPaikeNameSel.options.add(new  Option("全部", ""));

	$(data.items).each(function(i, value){
		var fOS = value["os"];
		var fOSID = value["osid"];
		var fName = value["fname"];
		var fID = value["fid"];
		var ftype = value["type"];
		var fosi = in_array(fOS, promoPaikeOSArr);
		if(fosi == -1) {
			promoPaikeOSArr.push(fOS);
			promoPaikeOSIDArr.push(fOSID);
			fosi=promoPaikeOSArr.length-1;
			promoPaikeOSOrderArr[fosi] = new Array();
			promoPaikeOSOrderArr[fosi][0] = new Array(); //厂商ID
			promoPaikeOSOrderArr[fosi][1] = new Array(); //厂商名
			promoPaikeOSSel.options.add(new  Option(fOS, fOSID));
		}
		var fnamei = in_array(fID, promoPaikeOSOrderArr[fosi][0])
		if (fnamei == -1)
		{
			promoPaikeOSOrderArr[fosi][0].push(fID);
			promoPaikeOSOrderArr[fosi][1].push(fName);
		}

		var fnamei = in_array(fName, promoPaikeNameArr);
		if(fnamei == -1) {
			promoPaikeNameArr.push(fName);
			promoPaikeIDArr.push(fID);
			fnamei=promoPaikeNameArr.length-1;
			promoPaikeNameOrderArr[fnamei] = new Array();
			promoPaikeNameOrderArr[fnamei][0] = new Array(); //OSID
			promoPaikeNameOrderArr[fnamei][1] = new Array(); //OS名
			promoPaikeNameSel.options.add(new  Option(fName, fID));
		}
		fosi = in_array(fOSID, promoPaikeNameOrderArr[fnamei][0]);
		if (fosi == -1)
		{
			promoPaikeNameOrderArr[fnamei][0].push(fOSID);
			promoPaikeNameOrderArr[fnamei][1].push(fOS);

		}		
	});
	promoPaikeTypeSel.selectedIndex = 0;
	getPromoPaikeData();
	jQuery('#body-wrapper').hideLoading();
}


function loadPromoPaikeList_caonima(data) {
	promoPaikeOSArr = new Array();
	promoPaikeOSIDArr = new Array();
	promoPaikeNameArr = new Array();
	promoPaikeIDArr = new Array();
	promoPaikeOSOrderArr = new Array();
	promoPaikeNameOrderArr = new Array();
	promoPaikeOSSel = document.getElementById("PromoPaikeOS");
	promoPaikeNameSel  = document.getElementById("PromoPaikeFactory");
	promoPaikeTypeSel  = document.getElementById("PromoPaikeType");
	promoPaikeOSSel.options.length = 0;
	promoPaikeNameSel.options.length = 0;
	promoPaikeOSSel.options.add(new  Option("全部", ""));
	promoPaikeNameSel.options.add(new  Option("全部", ""));

	$(data.items).each(function(i, value){
		var fOS = value["os"];
		var fOSID = value["osid"];
		var fName = value["fname"];
		var fID = value["fid"];
		var ftype = value["type"];
		var fosi = in_array(fOS, promoPaikeOSArr);
		if(fosi == -1) {
			promoPaikeOSArr.push(fOS);
			promoPaikeOSIDArr.push(fOSID);
			fosi=promoPaikeOSArr.length-1;
			promoPaikeOSOrderArr[fosi] = new Array();
			promoPaikeOSOrderArr[fosi][0] = new Array(); //厂商ID
			promoPaikeOSOrderArr[fosi][1] = new Array(); //厂商名
			promoPaikeOSSel.options.add(new  Option(fOS, fOSID));
		}
		var fnamei = in_array(fID, promoPaikeOSOrderArr[fosi][0])
		if (fnamei == -1)
		{
			promoPaikeOSOrderArr[fosi][0].push(fID);
			promoPaikeOSOrderArr[fosi][1].push(fName);
		}

		var fnamei = in_array(fName, promoPaikeNameArr);
		if(fnamei == -1) {
			promoPaikeNameArr.push(fName);
			promoPaikeIDArr.push(fID);
			fnamei=promoPaikeNameArr.length-1;
			promoPaikeNameOrderArr[fnamei] = new Array();
			promoPaikeNameOrderArr[fnamei][0] = new Array(); //OSID
			promoPaikeNameOrderArr[fnamei][1] = new Array(); //OS名
			promoPaikeNameSel.options.add(new  Option(fName, fID));
		}
		fosi = in_array(fOSID, promoPaikeNameOrderArr[fnamei][0]);
		if (fosi == -1)
		{
			promoPaikeNameOrderArr[fnamei][0].push(fOSID);
			promoPaikeNameOrderArr[fnamei][1].push(fOS);

		}		
	});
	promoPaikeTypeSel.selectedIndex = 0;
	getPromoPaikeData_caonima();
	//jQuery('#body-wrapper').hideLoading();
}

//改变渠道类型
function changePromoPaikeFactoryType(obj) {
    
    
    var ftype = obj.options[obj.selectedIndex].value;
    
	var api = "/client/promoFactoryName?btype=paike&ftype=" + obj.options[obj.selectedIndex].value;
	$.ajax({
		type: "GET",
		url: api,
		dataType : "jsonp",
		jsonnp: "callback",
		success: loadPromoPaikeList_caonima
	});
    
    
    $.ajax({
		type: "GET",
		url: "/client/getpnamecn",
        dataType: "html",
        data : {type : "paike",ftype:ftype},
		success: function(msg){
            
            
            $("#pnamecnpaike").html(msg);
            
            
            
            
            
            
            (function( $ ) {
		$.widget( "ui.comboboxpropaike", {
			_create: function() {
				var input,
					that = this,
					select = this.element.hide(),
					selected = select.children( ":selected" ),
					value = selected.val() ? selected.text() : "",
					wrapper = this.wrapper = $( "<span>" )
						.addClass( "ui-combobox" )
						.insertAfter( select );

				function removeIfInvalid(element) {
					var value = $( element ).val(),
						matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( value ) + "$", "i" ),
						valid = false;
					select.children( "option" ).each(function() {
						if ( $( this ).text().match( matcher ) ) {
							this.selected = valid = true;
							return false;
						}
					});
					if ( !valid ) {
						// remove invalid value, as it didn't match anything
						$( element )
							.val( "" )
							.attr( "title", value + " didn't match any item" )
							.tooltip( "open" );
						select.val( "" );
						setTimeout(function() {
							input.tooltip( "close" ).attr( "title", "" );
						}, 2500 );
						input.data( "autocomplete" ).term = "";
						return false;
					}
				}

				input = $( "<input>" )
					.appendTo( wrapper )
					.val( value )
					.attr( "title", "" )
					.addClass( "ui-state-default ui-combobox-input" )
					.autocomplete({
						delay: 0,
						minLength: 0,
						source: function( request, response ) {
							var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
							response( select.children( "option" ).map(function() {
								var text = $( this ).text();
								if ( this.value && ( !request.term || matcher.test(text) ) )
									return {
										label: text.replace(
											new RegExp(
												"(?![^&;]+;)(?!<[^<>]*)(" +
												$.ui.autocomplete.escapeRegex(request.term) +
												")(?![^<>]*>)(?![^&;]+;)", "gi"
											), "<strong>$1</strong>" ),
										value: text,
										option: this
									};
							}) );
						},
						select: function( event, ui ) {
							ui.item.option.selected = true;
							that._trigger( "selected", event, {
								item: ui.item.option
							});
						},
						change: function( event, ui ) {
							if ( !ui.item ){
								return removeIfInvalid( this );
                            }else{
                                
                                changePromoPaikeFactory(this.value);
                            
                            //alert(this.value);
                            cq = 'cq';
                            
                        }
                                
						}
					})
					.addClass( "ui-widget ui-widget-content ui-corner-left" );

				input.data( "autocomplete" )._renderItem = function( ul, item ) {
					return $( "<li>" )
						.data( "item.autocomplete", item )
						.append( "<a>" + item.label + "</a>" )
						.appendTo( ul );
				};

				$( "<a>" )
					.attr( "tabIndex", -1 )
					.attr( "title", "Show All Items" )
					.tooltip()
					.appendTo( wrapper )
					.button({
						icons: {
							primary: "ui-icon-triangle-1-s"
						},
						text: false
					})
					.removeClass( "ui-corner-all" )
					.addClass( "ui-corner-right ui-combobox-toggle" )
					.click(function() {
						// close if already visible
						if ( input.autocomplete( "widget" ).is( ":visible" ) ) {
							input.autocomplete( "close" );
							removeIfInvalid( input );
							return;
						}

						// work around a bug (likely same cause as #5265)
						$( this ).blur();

						// pass empty string as value to search for, displaying all results
						input.autocomplete( "search", "" );
						input.focus();
					});

					input
						.tooltip({
							position: {
								of: this.button
							},
							tooltipClass: "ui-state-highlight"
						});
			},

			destroy: function() {
				this.wrapper.remove();
				this.element.show();
				$.Widget.prototype.destroy.call( this );
			}
		});
	})( jQuery );

	$(function() {
		$( "#PromoPaikeFactory_cn" ).comboboxpropaike();
		$( "#toggle" ).click(function() {
			$( "#PromoPaikeFactory_cn" ).toggle();
		});
        
        
       $('.ui-combobox-input').focus(function(){
        $(this).val('');
        $(this).keydown();
    }); 
        
        
	});
            
            
            
            
            
            
         
								}
				});
    
    
    
}


//改变厂商名选项
function changePromoPaikeFactory(obj) {
	var promoPaikeSelOS = promoPaikeOSSel.options[promoPaikeOSSel.selectedIndex].text;
	var fnamei = in_array(obj, promoPaikeNameArr);//in_array(obj.options[obj.selectedIndex].text, promoPaikeNameArr);
	var fosi = promoPaikeOSSel.selectedIndex;

	promoPaikeOSSel.options.length=0;
	promoPaikeOSSel.options.add(new  Option("全部", ""));

	//如果厂商选择的不是全部
	if(fnamei != -1) {
		for(i=0; i<promoPaikeNameOrderArr[fnamei][0].length; i++) {
			promoPaikeOSSel.options.add(new  Option(promoPaikeNameOrderArr[fnamei][1][i], promoPaikeNameOrderArr[fnamei][0][i]));
			if (promoPaikeSelOS == promoPaikeNameOrderArr[fnamei][1][i]) 
				promoPaikeOSSel.selectedIndex = promoPaikeOSSel.options.length -1;
		}
	}
	//如果厂商选择的是全部
	else {
		for(i=0; i<promoPaikeOSArr.length; i++) {
			promoPaikeOSSel.options.add(new  Option(promoPaikeOSArr[i], promoPaikeOSIDArr[i]));
			if (promoPaikeSelOS == promoPaikeOSArr[i]) 
				promoPaikeOSSel.selectedIndex = promoPaikeOSSel.options.length -1;				
			
		}
	}
}

//改变平台名选项
function changePromoPaikeOS(obj) {
    
    promoPaikeNameSel  = document.getElementById("PromoPaikeFactory_cn");
    
	var promoPaikeSelFactory = promoPaikeNameSel.options[promoPaikeNameSel.selectedIndex].text;
	var fosi = in_array(obj.options[obj.selectedIndex].text, promoPaikeOSArr);
	var fnamei = promoPaikeNameSel.selectedIndex;

    promoPaikeNameSel  = document.getElementById("PromoPaikeFactory");

	promoPaikeNameSel.options.length=0;
	promoPaikeNameSel.options.add(new  Option("全部", ""));

	//如果平台选择的不是全部
	if(fosi != -1) {
		for(i=0; i<promoPaikeOSOrderArr[fosi][0].length; i++) {
			promoPaikeNameSel.options.add(new  Option(promoPaikeOSOrderArr[fosi][1][i], promoPaikeOSOrderArr[fosi][0][i]));
			if (promoPaikeSelFactory == promoPaikeOSOrderArr[fosi][1][i])
				promoPaikeNameSel.selectedIndex = promoPaikeNameSel.options.length -1;			
		}
	}
	//如果平台选择的是全部
	else {
		for(i=0; i<promoPaikeNameArr.length; i++) {
			promoPaikeNameSel.options.add(new  Option(promoPaikeNameArr[i], promoPaikeIDArr[i]));
			if (promoPaikeSelFactory == promoPaikeNameArr[i]) 
				promoPaikeNameSel.selectedIndex = promoPaikeNameSel.options.length -1;
		}
	}
}

//查询统计数据
var PromoPaikeCheckedItems;
function getPromoPaikeData() {
	var startDate = $("#PromoPaikeStartDate").val();
	var endDate = $("#PromoPaikeEndDate").val();
	var ftype = document.getElementById("PromoPaikeFactoryType").options[document.getElementById("PromoPaikeFactoryType").selectedIndex].value;
	var osID = document.getElementById("PromoPaikeOS").options[document.getElementById("PromoPaikeOS").selectedIndex].value;
	var typeID = document.getElementById("PromoPaikeType").options[document.getElementById("PromoPaikeType").selectedIndex].value;
	var fID = document.getElementById("PromoPaikeFactory_cn").options[document.getElementById("PromoPaikeFactory_cn").selectedIndex].value;
    if(fID == "全部"){
    fID = "";
    }
	$(".PromoPaikeChart").html("");

	if (startDate != "" && endDate != "")
	{
		var start = new Date();
		var end = new Date();

		//统计项
		var items = document.getElementsByName("PromoPaikeCheckbox");
		PromoPaikeCheckedItems = new Array();
		for(var i=0;i<items.length;i++) {
			if (items[i].checked)
			{
				PromoPaikeCheckedItems.push(items[i].value);
			}
		}

		if(PromoPaikeCheckedItems.length > 0) {
			jQuery('#body-wrapper').showLoading();
			start.setFullYear(startDate.substring(0,4), startDate.substring(5,7)-1, startDate.substring(8,10));
			end.setFullYear(endDate.substring(0,4), endDate.substring(5,7)-1 ,endDate.substring(8,10));

			days = parseInt((end - start)/1000/60/60/24)+1;

			var APIurl = "/client/promoVideoAnalytics?btype=paike&staDate="+startDate+"&pd="+days;
			if (ftype != "")
				APIurl += "&ftype="+ftype;
			if (osID != "")
				APIurl += "&osid="+osID;
			if (typeID != "")
				APIurl += "&type="+typeID;
			if (fID != "")
				APIurl += "&fid="+fID;

			$.ajax({
				type: "GET",
				url: APIurl,
				dataType : "jsonp",
				jsonnp: "callback",
				success: loadPromoPaikeData
			});
            
            
            $.ajax({
  url: APIurl,
  type: "POST",
  data: "username="+login_username,
success: function(msg){
   //alert('ok');
}
});
            
            
		}
		else
			alert("请选择至少一个统计项");
	}
	else {
		alert("请选择时间区域");
	}
}

function getPromoPaikeData_caonima() {
	var startDate = $("#PromoPaikeStartDate").val();
	var endDate = $("#PromoPaikeEndDate").val();
	var ftype = document.getElementById("PromoPaikeFactoryType").options[document.getElementById("PromoPaikeFactoryType").selectedIndex].value;
	var osID = document.getElementById("PromoPaikeOS").options[document.getElementById("PromoPaikeOS").selectedIndex].value;
	var typeID = document.getElementById("PromoPaikeType").options[document.getElementById("PromoPaikeType").selectedIndex].value;
	var fID = document.getElementById("PromoPaikeFactory_cn").options[document.getElementById("PromoPaikeFactory_cn").selectedIndex].value;
    if(fID == "全部"){
    fID = "";
    }
	//$(".PromoPaikeChart").html("");

	if (startDate != "" && endDate != "")
	{
		var start = new Date();
		var end = new Date();

		//统计项
		var items = document.getElementsByName("PromoPaikeCheckbox");
		PromoPaikeCheckedItems = new Array();
		for(var i=0;i<items.length;i++) {
			if (items[i].checked)
			{
				PromoPaikeCheckedItems.push(items[i].value);
			}
		}

		
	}
	else {
		alert("请选择时间区域");
	}
}

var PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeSumArr, PromoPaikeDateArr, PromoPaikeSubTitle;
function loadPromoPaikeData(data) {
	jQuery('#body-wrapper').hideLoading();	
	var fID = document.getElementById("PromoPaikeFactory_cn").options[document.getElementById("PromoPaikeFactory_cn").selectedIndex].value;
    if(fID == "全部"){
    fID = "";
    }
	var osID = document.getElementById("PromoPaikeOS").options[document.getElementById("PromoPaikeOS").selectedIndex].value;
	var typeID = document.getElementById("PromoPaikeType").options[document.getElementById("PromoPaikeType").selectedIndex].value;
	var tab = "";
	var startDate = $("#PromoPaikeStartDate").val();
	var endDate = $("#PromoPaikeEndDate").val();
	PromoPaikeSubTitle = startDate.replace(/\//g, "-") + " 至 " + endDate.replace(/\//g, "-");

	PromoPaikeTabArr = new Array();
	PromoPaikeDetailArr = new Array();
	PromoPaikeSumArr = new Array();
	PromoPaikeDateArr = new Array();


	//读取数据
	if (data.items.length > 0) //平台选择全部
	{
		if (fID == "") //厂商选择全部
		{	
			$("#PromoPaikeLineTab").hide();
			$("#PromoPaikeLine").html("");
			//显示选择Tab
			$("#PromoPaikeTab").html("<div id=\"PromoPaikeTabAll\" class=\"bitem selbitem\">总览</div>");
			//读取数据
			for(n=0; n<PromoPaikeCheckedItems.length; n++) 
				PromoPaikeSumArr[n] = new Array();
			for(i=1; i<document.getElementById("PromoPaikeFactory_cn").options.length; i++) {
				var tabName = document.getElementById("PromoPaikeFactory_cn").options[i].text;
				PromoPaikeTabArr.push(tabName);
				PromoPaikeDetailArr[i-1] = new Array();
			}
			readSummaryData(data, PromoPaikeDateArr, "fname", PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeCheckedItems, PromoPaikeSumArr);
			changeChartType('PromoPaike', 'Pie');
			//生成图表
			genTop10Table("PromoPaikeTable", valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeCheckedItems);
			//生成饼图
			genTop10PieChart(PromoPaikeCheckedItems, "PromoPaikePie", PromoPaikeDetailArr, PromoPaikeSubTitle, "fname", "渠道Top10");
		}
		else if (osID == "") //平台选择全部
		{
			$("#PromoPaikeLineTab").hide();
			$("#PromoPaikeLine").html("");
			//显示选择Tab
			$("#PromoPaikeTab").html("<div id=\"PromoPaikeTabAll\" class=\"bitem selbitem\">总览</div>");
			//读取数据
			for(n=0; n<PromoPaikeCheckedItems.length; n++) 
				PromoPaikeSumArr[n] = new Array();
			for(i=1; i<document.getElementById("PromoPaikeOS").options.length; i++) {
				var tabName = document.getElementById("PromoPaikeOS").options[i].text;
				PromoPaikeTabArr.push(tabName);
				PromoPaikeDetailArr[i-1] = new Array();
			}
			readSummaryData(data, PromoPaikeDateArr, "os", PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeCheckedItems, PromoPaikeSumArr);
			changeChartType('PromoPaike', 'Pie');
			//生成图表
			genTop10Table("PromoPaikeTable", valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeCheckedItems);
			//生成饼图
			genTop10PieChart(PromoPaikeCheckedItems, "PromoPaikePie", PromoPaikeDetailArr, PromoPaikeSubTitle, "os", "平台Top10");

		}
		else if (typeID == "") //终端选择为全部
		{
			$("#PromoPaikePieTab").show();
			$("#PromoPaikeTab").show();
			$("#PromoPaikeLineTab").show();
			//显示选择Tab
			genTabs("PromoPaike", "PromoPaikeType", PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeSumArr, PromoPaikeCheckedItems);
			//读取数据
			readData(data, PromoPaikeDateArr, "type", PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeCheckedItems, PromoPaikeSumArr);
			//生成图表
			genSummaryTable("PromoPaikeTable", valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeDateArr, PromoPaikeSumArr, -1, "");
			//生成饼图
			genSelPieChart(PromoPaikeCheckedItems, "PromoPaikePie", PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeSubTitle);
			//生成线形图
			genSummaryLineChart("PromoPaikeLine", "总览趋势图", PromoPaikeDateArr, valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeSumArr, PromoPaikeSubTitle);

		}
		else //厂商、平台、终端均不为全部
		{
			for(n=0; n<PromoPaikeCheckedItems.length; n++) 
				PromoPaikeSumArr[n] = new Array();
			$("#PromoPaikePieTab").hide();
			$("#PromoPaikePie").html("");
			$("#PromoPaikeTab").hide();
			$("#PromoPaikeLineTab").show();

			//读取数据
			readData(data, PromoPaikeDateArr, "", PromoPaikeTabArr, PromoPaikeDetailArr, PromoPaikeCheckedItems, PromoPaikeSumArr);
			//生成图表
			genSummaryTable("PromoPaikeTable", valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeDateArr, PromoPaikeSumArr, -1, "");
			//生成线形图
			genSummaryLineChart("PromoPaikeLine", "总览趋势图", PromoPaikeDateArr, valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeSumArr, PromoPaikeSubTitle);

		}
	}
	else 
		alert("选择的时间区间内无数据");	
}

function changePromoPaikeTab(tabName, optionName) {
	changeChartType('PromoPaike', 'Line');
	if (tabName == "All")
	{
		$("#PromoPaikePieTab").show();
		$("#PromoPaikeTab").show();

		//生成饼图
		genSelPieChart(PromoPaikeCheckedItems, "PromoPaikePie", PromoPaikeTabArr, PromoPaikeDetailArr, MainSubTitle);
		//生成线形图
		genSummaryLineChart("PromoPaikeLine", "总览趋势图", PromoPaikeDateArr, valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeSumArr, PromoPaikeSubTitle);
		//生成表格
		genSummaryTable("PromoPaikeTable", valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeDateArr, PromoPaikeSumArr, -1, "");
	}
	else {
		$("#PromoPaikePieTab").hide();
		$("#PromoPaikePie").html("");
		$("#PromoPaikeLineTab").show();

		//生成线形图
		genSummaryLineChart("PromoPaikeLine", "总览趋势图", PromoPaikeDateArr, valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeDetailArr[tabName], PromoPaikeSubTitle);
		//生成表格
		genSummaryTable("PromoPaikeTable", valueFullNameArr(PromoPaikeCheckedItems), PromoPaikeDateArr, PromoPaikeDetailArr, tabName, PromoPaikeTabArr);
		if ($("#PromoPaikePieTab").hasClass("selbitem"))
			changeChartType('PromoPaike', 'Line');
	} 
	$(".bitem").removeClass("selbitem");
	$("#PromoPaikeTab"+tabName).addClass("selbitem");		
    getCSVData_save("PromoPaikeTable");			

}

